import React, { Component } from 'react';
import { inject, observer } from "mobx-react"
//引入常量定义
import CONSTS from '@/inits/consts'
//引入layers蒙层的子组件
import LoadingLayer from '@/pages/layers/loading'
import Fromlayer from '@/pages/layers/fromlayer'

/* 蒙层组件 */
//此处模拟获取数据延迟,直接this.state,感觉没必要用store,因为store变量很多了
@inject('store')
@observer
class Layers extends Component<any, any>{
  constructor(props) {
    super(props)
    this.state = {
      loading: true,
    }
  }
  componentDidMount() {
     setTimeout(() => {
        this.setState({
          loading: false
        })
      }, CONSTS.LAYERTIME)
  }
  render() {
    return (
      <div>
        {/* 加载中蒙层组件 */}
        {<LoadingLayer loading={this.state.loading} />}
        {/* 表单蒙层 */}
        {<Fromlayer visible={this.props.store.visible} />}
      </div>
    )
  }
}

export default Layers